package org.huangrui.controller;

import jakarta.annotation.Resource;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author hr
 * @Create 2025-11-10 23:45
 **/
@RestController
public class DeePseekController {
    @Resource
    private OpenAiChatModel openAiChatModel;
    // http://localhost:8001/deepseek
    @GetMapping("/deepseek")
    public String chat(@RequestParam (value = "prompt", defaultValue = "你是谁") String prompt){
        String result = openAiChatModel.call(prompt);
        System.out.println(result);
        return result;
    }
}
